<template>
    <div>
        <tr>
                <td>会员名称</td>
                <td>
                    <input type="text" v-model="querydata.usename">
                </td>
                <td>会员时间</td>
                <td>
                    <input type="date" v-model="querydata.usetime">
                </td>
                <td>会员性别</td>
                <td>
                    <select v-model="querydata.sex">
                        <option value="0">请选择</option>
                        <option value="1">男</option>
                        <option value="2">女</option>
                    </select>
                </td>
                <td>
                    <input type="button" value="查询" @click="getedata">
                </td>
            </tr>
        <table>
           
            <thead>
                <tr>
                    <td>会员编号</td>
                    <td>会员名称</td>
                    <td>会员时间</td>
                    <td>会员性别</td>
                    <td>会员手机号</td>
                    <td>会员地址</td>
                    <td>操作</td>
                </tr>
            </thead>
            <tbody>
                <tr v-for="a in data">
                    <td>{{a.Hid}}</td>
                    <td>{{a.Hname}}</td>
                    <td>{{a.Htime}}</td>
                    <td>{{a.Phone}}</td>
                    <td>{{a.Xingbie}}</td>
                    <td>{{a.Adds}}</td>
                    <td>
                        <input type="button" value="删除" @click="shan(a.Hid)">
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue';
import axios from 'axios';
import moment from 'moment';

const shan=(id:any)=>{
    axios.delete("https://localhost:7016/api/hui/DeleteHui",{params:{id:id}}).then(res=>{
    if(res.data>0)
    {
    alert("删除成功");
    getedata();
    }
    else
    {
    alert("删除失败");
    }
})}




//Model
const data=ref([
  {
    "Hid": 0,
    "Hname": "",
    "Htime": "",
    "Xingbie": 0,
    "Phone": "",
    "Adds": ""
  }
]);

const querydata=ref({
    usename:"",
    sex:0,
    usetime:""
});

//文档就绪
onMounted(()=>{
    getedata();
});



const getedata=()=>{axios.get("https://localhost:7016/api/hui/GetHui",{params:querydata.value}).then(
   
res=>{
    data.value=res.data
})
}


</script>

<style scoped>

</style>